Skip to content

yarn why: Support scoped package query#1524

Closed
evocateur wants to merge 1 commit into
yarnpkg:masterfrom
evocateur:fix-scoped-why
Closed

yarn why: Support scoped package query#1524
evocateur wants to merge 1 commit into
yarnpkg:masterfrom
evocateur:fix-scoped-why

Conversation

@evocateur
Copy link
Copy Markdown

Summary

This avoids breaking scoped package names when cleaning the query of yarn why.

$ yarn init -y
$ yarn add @financial-times/n-bottle
$ yarn why @financial-times/n-bottle
yarn why v0.16.1
[1/4] 🤔  Why do we have the module "@financial-times/n-bottle"...?
[2/4] 🚚  Initialising dependency graph...
[3/4] 🔍  Finding dependency...
error We couldn't find a match!
✨  Done in 0.08s.

Test plan

A scoped package name always has a slash in it, which was being unconditionally stripped ('@foo/bar' => '@foo'). This was ascertained by a bunch of gnarly console.log() statements. I regret I don't have the time to write a full test suite for this subcommand.

yarn why @financial-times/n-bottle
yarn why v0.16.2
[1/4] 🤔  Why do we have the module "@financial-times/n-bottle"...?
[2/4] 🚚  Initialising dependency graph...
[3/4] 🔍  Finding dependency...
[4/4] 🚡  Calculating file sizes...
info Has been hoisted to "@financial-times/n-bottle"
info This module exists because it's specified in "dependencies".
info Disk size without dependencies: "56kB"
info Disk size with unique dependencies: "360kB"
info Disk size with transitive dependencies: "384kB"
info Amount of shared dependencies: 5
✨  Done in 0.10s.

A scoped package name always has a slash in it, which was being unconditionally stripped (`'@foo/bar' => '@foo'`).
@sebmck
Copy link
Copy Markdown
Contributor

sebmck commented Oct 27, 2016

This isn't a valid fix since we need to support queries like yarn why @scope/package/file/node_modules/dependency which this would not properly resolve.

@evocateur
Copy link
Copy Markdown
Author

@kittens Thanks for the clarification, I'll investigate a better fix.

@jvhoven
Copy link
Copy Markdown
Contributor

jvhoven commented Oct 28, 2016

Related to #1529.

@sebmck
Copy link
Copy Markdown
Contributor

sebmck commented Nov 1, 2016

Created #1593 to fix this, pending approval.

@sebmck sebmck closed this Nov 1, 2016
@evocateur
Copy link
Copy Markdown
Author

Thanks!

@evocateur evocateur deleted the fix-scoped-why branch November 3, 2016 22:41
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants